<template>
  <div>
    新闻标题<input type="text" v-model="aa.title">
    新闻内容<input type="text" v-model="aa.content">
    <button @click="add">添加</button>
    <button @click="det">查看新闻列表</button>
  </div>
</template>

<script>
export default {
  name: "aaa",
  data(){
    return{
      aa:{},

    }
  },
  methods:{
    add(){
      this.$axios.post('users/news/',this.form)
        .then(res=>{
          if (res.data.code==200){
            alert('添加成功')
          }
        })
    },
    det(){
      var userid = localStorage.getItem('userid')
      if(this.userid){
        this.$router.push('day04_shoemews')
      }
      else {
        this.$router.push('day04_login')
      }
    }
  },

}
</script>

<style scoped>

</style>
